<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="root">
			<h2>当前的n是：<span v-text="n"></span></h2>
			<h2>放大10倍后的n是：<span v-big="n"></span></h2>
			<button @click="n++">点我n+1</button>
			<hr >
			<input type="text" v-fbind:value="n">
		</div>
		<script type="text/javascript">
			const vm = new Vue({
				el: '#root',
				data: {
					n: 1
				},
				directives: {
					big(element, binding) {
						element.innerHTML = binding.value * 10
					},
					fbind:{
						bind(element,binding){
							element.value=binding.value
						},
						inserted(element,binding){
							element.focus();
						},
						update(element,binding){
							element.value=binding.value
						}
					}
				}
			})
		</script>
	</body>
</html>
